package com.zretc.points.service;


import com.zretc.api.pojo.SysUser;
import com.zretc.points.dao.pointsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class PointsService {
    @Autowired
    private pointsMapper mapper;

    public void addPoints(int id , int points){
        mapper.addpoints(id,points);
    }

    public int getPoints(int actionid){
       return mapper.getActionPoints(actionid);
    }

    public void addChangeMes(Integer userId, int points,String changeMes) {
        SysUser user = mapper.getUserpoints(userId);
        int afterpoint=user.getPoints()+points;
        mapper.addChangeMes(userId,user.getUser_name(),user.getPoints(),afterpoint,points,changeMes);

    }
}
